package com.iengine.services.api.command.memo;

import com.iengine.services.api.utils.Constant;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;


public class CommandMemos extends AbstractTxtMemosApiCommand {
	
	public final static String FIELD_EVENT_ID = "eventId";
	public final static String FIELD_EVENT_TYPE = "eventType";
	public final static String FIELD_ACTION = "action";
	public final static String FIELD_EXECUTE_TIME = "executeTime";
	public final static String FIELD_EVENT_CONTENT = "eventContent";
	public final static String FIELD_IS_EXECUTE = "isExecute";
	public final static String FIELD_IS_OVER_DUE = "isOverDue";
	public final static String ACTION_DELETE = "delete";
	public final static String ACTION_ADD = "add";
	public final static String ACTION_UPDATE = "update";
	
	public final static String EVENT_TYPE_APPLICANCE_MEMO = "applicanceMemo";
	public final static String EVENT_TYPE_MUSIC_MEMO = "musicMemo";
	public final static String EVENT_TYPE_ALARM_MEMO = "alarmMemo";
	public final static String EVENT_TYPE_REMIND_MEMO = "remindMemo";
	
	
	public final static String TRUE = "true";
	public final static String FALSE = "false";
	
	
	
	@Override
	protected Map<String, Object> formatArgs(Map map, Map nlpParams) {
		// TODO Auto-generated method stub
//		HReply reply = getRemoteData(map, nlpParams);
		map = this.getFormatResult(map, nlpParams);

		return map;
	}
	

	protected Map<String, Object> getFormatResult(Map map, Map<String, Object> nlpParams) {


//		Map request  =  (Map) map.get("HttpRequestContent");
//    	String nlpData =  (String) request.get("nlpdata");
//    	String memoTxt = MatchMemo.getInstance().getMemo(nlpData).toString();
		String time = (String) nlpParams.get("Time");
		String content = (String) nlpParams.get("Event");
//    	if (memoTxt.split("#").length==2) {
//    		String[] memoTxtList  = memoTxt.split("#");
//    		time = memoTxtList[0];
//    		content = memoTxtList[1];
//		}else{
//			time=nlpData;
//			content = (String)nlpParams.get("Event");
//		}
		Map<String , Object> cmdData = new HashMap<String, Object>();
		cmdData.put(FIELD_EVENT_ID, UUID.randomUUID().toString());
		cmdData.put(FIELD_EVENT_TYPE, EVENT_TYPE_REMIND_MEMO);
//		//0是txt，1是家电，2是音乐
//		if ("0".equals(evrntType)) {
//			
//			
//		}else if("1".equals(evrntType)){
//			
//			cmdData.put(FIELD_EVENT_TYPE, EVENT_TYPE_APPLICANCE_MEMO);
//			
//		}else if("2".equals(evrntType)){
//			
//			cmdData.put(FIELD_EVENT_TYPE, EVENT_TYPE_MUSIC_MEMO);
//			
//		}
		
		cmdData.put(FIELD_ACTION, ACTION_ADD);
		cmdData.put(FIELD_EXECUTE_TIME, time);
		cmdData.put(FIELD_EVENT_CONTENT, content);
		cmdData.put(FIELD_IS_EXECUTE, TRUE);
		cmdData.put(FIELD_IS_OVER_DUE, FALSE);
		
		map.put(Constant.COMMAND_DATA, cmdData);
		return map;
	}

}
